﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;

namespace XWG.JWBST.JWBSTDAL
{
    public class LetterDAL
    {
        public static DataTable GetLikeInfo(string phone, string psd,string id)
        {
            string sql = "select id,tabletype,content,createdate,zb_bljg,zb_blrq from V_LETTER t where phone = :phone and psd = :psd and id != :id";
            List<OracleParameter> m_params = new List<OracleParameter>();
            if (string.IsNullOrEmpty(psd))
            {
                sql = "select id,tabletype,content,createdate,zb_bljg,zb_blrq from V_LETTER t where phone = :phone and psd is null and id != :id";
                m_params.Add(new OracleParameter(":phone", phone));
                m_params.Add(new OracleParameter(":id", id));
            }
            else
            {
                m_params.Add(new OracleParameter(":phone", phone));
                m_params.Add(new OracleParameter(":psd", psd));
                m_params.Add(new OracleParameter(":id", id));
            }
            return OrclHelper.GetDT(sql, m_params.ToArray());
        }
    }
}
